package cn.wbu.zyh.mapper;

import cn.wbu.zyh.entity.Team;
import cn.wbu.zyh.entity.TeamArticle;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TeamArticleMapper {
    @Insert("insert into team_articles(team_id,username,article_id,access_level,created_time,updated_time)" +
            " VALUES (#{teamId}, #{username}, #{articleId}, #{accessLevel},#{createdTime},#{updatedTime})")
    void addCollaborator(TeamArticle teamArticle);

    @Select("SELECT id,username, access_level FROM team_articles WHERE article_id = #{id}")
    List<TeamArticle> getByNoteId(Long id);

    @Delete("DELETE FROM team_articles WHERE article_id = #{articleId} ")
    void deleteByArticleId(Long articleId);
}
